﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace linq
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] list = new int[105];
            Random random = new Random();
            for (int i = 0; i < 100; i++)
                list[i] = random.Next(0,1000);
            var m = from n in list where n > 0 orderby n descending select n;
            int sum = 0;
            foreach(var n in m)
            {
                Console.WriteLine(n);
                sum += n;
            }
            Console.WriteLine("这些数的和为"+sum);
            Console.WriteLine("这些数的平均数为"+sum/100);
        }
    }
}
